package com.launch.carmanager.common.utils;

import android.app.Application;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.support.annotation.ArrayRes;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import android.support.v4.content.ContextCompat;

import com.launch.carmanager.common.MyApplication;

public final class ResourceUtils {

    private ResourceUtils() {
        // hide constructor
    }

    public static String getString(Context context, @StringRes int stringResId) {
        return context.getString(stringResId);
    }

    public static String getString(@StringRes int id) {
        return getString(MyApplication.getContext(), id);
    }

    public static Drawable getDrawable(Context context, @DrawableRes int drawableResID) {
        return ContextCompat.getDrawable(context, drawableResID);
    }
    public static int getColor(Context context, @ColorRes int colorResId) {
        return ContextCompat.getColor(context, colorResId);
    }

    public static int getColor(@ColorRes int colorResId) {
        return ContextCompat.getColor(MyApplication.getContext(), colorResId);
    }


    public static ColorStateList getColorStateList(Context context, @ColorRes int colorResId) {
        return ContextCompat.getColorStateList(context, colorResId);
    }

    public static int[] getIntArray(Context context, @ArrayRes int arrayResId) {
        return context.getResources().getIntArray(arrayResId);
    }


}
